package com.lagou.rpc.provider.config;

import com.lagou.rpc.provider.interceptor.Interceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author Liu Chang
 * @Date 2021/10/19 4:44 上午
 */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
    @Autowired
    private Interceptor interceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 将其注册到拦截器中
        registry.addInterceptor(interceptor).addPathPatterns("/**");
    }
}
